<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/11/6
 * Time: 15:11
 */
namespace app\modules\api\models;
use app\models\TencentLive;
/**
 * @property TencentLive $model
 */

class TencentLiveForm extends Model
{
    public $store_id;
    public $roomid;
    public $is_open;
    public $model;
    public function rules()
    {
        return [
            [['store_id','roomid'],'required'],
            [['store_id','is_open'],'integer'],
            [['roomid'],'string']
        ];
    }
    public function attributes()
    {
        return[
            'store_id'=>'StoreID',
            'roomid'=>'房间id',
        ];
    }
    public function save()
    {
       if(!$this->validate()){
           return $this->getModelError();
       }
       $this->model->store_id = $this->store_id;
       $this->model->roomid = $this->roomid;
       $this->model->is_open = $this->is_open;
       if($this->model->save()){
           return[
               'code'=>0,
               'msg'=>'保存成功',
           ];
       }else{
           return $this->getModelError($this->model);
       }

    }
}